package com.itheima.web.interceptor;

import com.itheima.domain.db.Admin;

public class AdminHolder {

   //创建ThreadLocal
    private static final ThreadLocal<Admin> TL=new ThreadLocal<>();

   //在ThreadLocal里存入管理者类
    public static void set(Admin admin){
        TL.set(admin);
    }

   //在ThreadLocal里取出管理者类
    public static Admin get(){
        return TL.get();
    }

    //ThreadLocal与管理者解绑
    public static void remove(){
        TL.remove();
    }
}
